<?php
$generalSalarialSheetReport = Dracosys::getSessionValue(SESSION_INTERFACE, 'GeneralSalarialSheetReport');
$positionSalarialSheetReport = Dracosys::getSessionValue(SESSION_INTERFACE, 'PositionSalarialSheetReport');
$departamentSalarialSheetReport = Dracosys::getSessionValue(SESSION_INTERFACE, 'DepartamentSalarialSheetReport');
$sectorSalarialSheetReport = Dracosys::getSessionValue(SESSION_INTERFACE, 'SectorSalarialSheetReport');
?>
<h2>Folha Salarial</h2>
<section id="SalarialSheet">
    <table id="SalarialSheet_ReportGeral" class="Report">
        <thead>
            <tr>
                <th colspan="5">Relat&oacute;rio Salarial</th>
            </tr>
            <tr class="header">
                <td>&nbsp;</td>
                <td>Total</td>
                <td>Qtd Funcionários</td>
                <td>Média</td>
                <td>% da Empresa</td>
            </tr>
        </thead>
        <tbody>
            <tr>
                <td>Total</td>
                <td><?=MathUtils::money($generalSalarialSheetReport['TotalEnterprise'])?></td>
                <td><?=$generalSalarialSheetReport['EmployeeQuantity']?></td>
                <td><?=MathUtils::money($generalSalarialSheetReport['Average'])?></td>
                <td><?=$generalSalarialSheetReport['Percentage']?>%</td>
            </tr>
        </tbody>
    </table>
    <table id="SalarialSheet_ReportFuncao" class="Report hide">
        <thead>
            <tr>
                <th colspan="5">Relatório por Função</th>
            </tr>
            <tr class="header">
                <td>Funçao</td>
                <td>Total</td>
                <td>Qtd Funcionários</td>
                <td>Média</td>
                <td>% da Empresa</td>
            </tr>
        </thead>
        <tbody>
            <?php foreach($positionSalarialSheetReport as $line): ?>
                <tr>
                    <td><?=$line['PositionName']?></td>
                    <td><?=MathUtils::money($line['TotalPosition'])?></td>
                    <td><?=$line['EmployeeQuantity']?></td>
                    <td><?=MathUtils::money($line['Average'])?></td>
                    <td><?=$line['Percentage']?>%</td>
                </tr>
            <?php endforeach; ?>
        </tbody>
    </table>
    <table id="SalarialSheet_ReportDepartamento" class="Report hide">
        <thead>
            <tr>
                <th colspan="5">Relatório por Departamento</td>
            </tr>
            <tr class="header">
                <td>Folha Salarial Total</td>
                <td>Total</td>
                <td>Qtd Funcionários</td>
                <td>Média</td>
                <td>% da Empresa</td>
            </tr>
        </thead>
        <tbody>
            <?php foreach($departamentSalarialSheetReport as $line): ?>
                <tr>
                    <td><?=$line['DepartamentName']?></td>
                    <td><?=MathUtils::money($line['TotalDepartament'])?></td>
                    <td><?=$line['EmployeeQuantity']?></td>
                    <td><?=MathUtils::money($line['Average'])?></td>
                    <td><?=$line['Percentage']?>%</td>
                </tr>
            <?php endforeach; ?>
        </tbody>
    </table>
    <table id="SalarialSheet_ReportSetor" class="Report hide">
        <thead>
            <tr>
                <th colspan="5">Relatório por Setor</th>
            </tr>
            <tr class="header">
                <td>Folha Salarial Total</td>
                <td>Total</td>
                <td>Qtd Funcionários</td>
                <td>Média</td>
                <td>% da Empresa</td>
            </tr>
        </thead>
        <tbody>
            <?php foreach($sectorSalarialSheetReport as $line): ?>
                <tr>
                    <td><?=$line['SectorName']?></td>
                    <td><?=MathUtils::money($line['TotalSector'])?></td>
                    <td><?=$line['EmployeeQuantity']?></td>
                    <td><?=MathUtils::money($line['Average'])?></td>
                    <td><?=$line['Percentage']?>%</td>
                </tr>
            <?php endforeach; ?>
        </tbody>
    </table>
    <div class="pagination">
        <a href="#" rel="ReportGeral" class="selected borderRadios">Geral</a>
        <a href="#" rel="ReportFuncao" class="nonselected borderRadios">Fun&ccedil;&acirc;o</a>
        <a href="#" rel="ReportDepartamento" class="nonselected borderRadios">Departamento</a>
        <a href="#" rel="ReportSetor" class="nonselected borderRadios">Setor</a>
    </div>
</section>